home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / win / pascal / ppfont.exe / READ.ME < prev   
Encoding:
Text File  |  1993-05-01  |  7.2 KB  |  175 lines

  1. PPFONT.DLL copyright 1993 Paul F. Poellinger
  2. -------------------------------------------------------------------
  3.  
  4. Included:
  5.  
  6. PPFONT   DLL                 The real deal
  7. READ     ME                  self-reference (this)
  8. PPGLOBAL TXT                 VB constants
  9. PPFONT   TXT                 C header file extract
  10. PPFONT   LIB                 Import library for C
  11.  
  12. PPFONT   FRM                 .. \    Visual Basic
  13. PPFONT   MAK                   ..>   (version 2.0)
  14. PPFONT   BAS                 .. /    Example of PPFont function use
  15.  
  16. PPFONTNM FRM                 .. \    Visual Basic
  17. PPFONTNM MAK                   ..>   (version 2.0)
  18. PPFONTNM BAS                 .. /    Example of PPFont function use
  19.  
  20.  
  21. ------------------------------ functions ------------------------------
  22.  
  23. PPFontFamNum  -- returns number of available font families
  24. PPFontFam     -- retrieves arrays of info about available font families
  25.  
  26. PPFontNum     -- returns number of available fonts in a family
  27. PPFont        -- retrieves arrays of info about fonts in a family
  28.  
  29. --------------------- C declarations ---------------------------------
  30.  
  31. int FAR PASCAL PPFontFamNum(HWND hwnd)
  32.           -- returns number of available font families
  33. int FAR PASCAL PPFontFam(HWND hwnd ,LPENUMLOGFONT lfstruct, LPNEWTEXTMETRIC tmstruct, LPINT ftype)
  34.           -- retrieves arrays of info about available font families
  35.  
  36. int FAR PASCAL PPFontNum(HWND hwnd, LPSTR lpszFamily)
  37.           -- returns number of available fonts in a family
  38. int FAR PASCAL PPFont(HWND hwnd ,LPENUMLOGFONT lfstruct, LPNEWTEXTMETRIC tmstruct, LPINT ftype, LPSTR lpszFamily)
  39.           -- retrieves arrays of info about fonts in a family
  40.  
  41. ------------ Visual Basic declarations ----------------------------
  42. Declare Function PPFontFam Lib "PPFONT.DLL" (ByVal hwnd As Integer, alf As NEWLOGFONT, atm As NEWTEXTMETRIC, aft As Integer) As Integer
  43. Declare Function PPFontFamNum Lib "PPFONT.DLL" (ByVal hwnd As Integer) As Integer
  44.  
  45. Declare Function PPFont Lib "PPFONT.DLL" (ByVal hwnd As Integer, alf As NEWLOGFONT, atm As NEWTEXTMETRIC, aft As Integer, ByVal afamily As String) As Integer
  46. Declare Function PPFontNum Lib "PPFONT.DLL" (ByVal hwnd As Integer, ByVal afamily As String) As Integer
  47.  
  48.           where:    hWnd ................ is a window handle
  49.                     alf  ................ is an array of logical font
  50.                                            structure as defined in
  51.                                            PPGLOBAL.TXT
  52.                     atm  ................ is an array of text metric
  53.                                            (physical font) structures
  54.                                            as defined in PPGLOBAL.TXT
  55.                     aft  ................ is an array of integers which
  56.                                           will receive the font type
  57.                                           (truetype, vector, raster, device)
  58.                     afamily ............. is a string variable which
  59.                                           contains the font family name
  60.                                           for which font info is desired
  61.  
  62.     NOTE: the NEWTEXTMETRIC and NEWLOGFONT structures are detailed
  63.           in the windows SDK.  Look there for a explanation of the
  64.           fields in them.  The layouts are included here in PPGLOBAL.TXT
  65.           and PPFONT.TXT, as are relevant variable declarations.
  66.  
  67. ======================== Visual Basic Example Usage ===================
  68. --------------------------------- font family info --------------------
  69.     Static lf() As NEWLOGFONT
  70.     Static tm() As NEWTEXTMETRIC
  71.     Static ftype() As Integer
  72.  
  73.     n = PPFontFamNum(hwnd)                       ' get number of families
  74.  
  75.     ReDim lf(n), tm(n), ftype(n)
  76.  
  77.     i = PPFontFam(hwnd, lf(1), tm(1), ftype(1))    ' get families
  78.  
  79.     For j = 1 To i
  80.         ft$ = "Vector"
  81.         If ftype(j) And TRUETYPE_FONTTYPE Then
  82.            ft$ = "TrueType"
  83.         Else
  84.            If ftype(j) And RASTER_FONTTYPE Then
  85.               ft$ = "Raster"
  86.            End If
  87.         End If
  88.         ' - - - - - - - - - - - - - - - - - - - - - remove null fill from
  89.         font$ = lf(j).lfFacename                   'structure string
  90.         For k = 1 To LF_FACESIZE
  91.             If Asc(Mid$(font$, k, 1)) = 0 Then
  92.                Exit For
  93.             End If
  94.         Next
  95.         font$ = Mid$(font$, 1, k - 1)
  96.         ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  97.  
  98.         l = Len(ft$)
  99.  
  100.         list1.AddItem font$ + "   * " + ft$
  101.     Next
  102.     list1.ListIndex = 4
  103.     list1_click
  104. ----------------------------- font info for a family -----------------
  105.     Static lf() As NEWLOGFONT
  106.     Static tm() As NEWTEXTMETRIC
  107.     Static ftype() As Integer
  108.  
  109.     list2.Clear
  110.     list3.Clear
  111.  
  112.     selfont$ = list1.List(list1.ListIndex)
  113.     n = InStr(selfont$, "*")
  114.     selfont$ = Trim(Mid$(selfont$, 1, n - 4))
  115.  
  116.     n = PPFontNum(hwnd, selfont$)         ' get number of fonts in family
  117.  
  118.     ReDim lf(n), tm(n), ftype(n)
  119.  
  120.     i = PPFont(hwnd, lf(1), tm(1), ftype(1), selfont$)    ' get fonts
  121.  
  122.     For j = 1 To i
  123.         list2.AddItem lf(j).lfFullname
  124.         list3.AddItem lf(j).lfStyle
  125.     Next
  126. ----------------------------- family/font name retrieval --------------
  127. *** the following is how I had to define the name strings to get
  128. *** VB to accept the font/family names on return
  129.  
  130. Type lfFaceName
  131.      FaceName As String * LF_FACESIZE                   ' 32
  132. End Type
  133. Type lfFullName
  134.      FullName As String * LF_FULLFACESIZE               ' 64
  135. end type
  136.  
  137.  
  138. Declare Function PPFontFamNames Lib "PPFONT.DLL" (ByVal hwnd As Integer, afn As lfFaceName, aft As Integer) As Integer
  139. Declare Function PPFontNames Lib "PPFONT.DLL" (ByVal hwnd As Integer, afn As lfFullName, aft As Integer, ByVal afamily As String) As Integer
  140.  
  141.     i = PPFontNames(hwnd, lf(1), ftype(1), selfont$)
  142.  
  143.     i = PPFontFamNames(hwnd, lf(1), ftype(1))
  144. ====================================================================
  145. Hope these are helpful.  There are others (see WINP1.1, ORIENT.ZIP,
  146. PPRTR2.ZIP, Compuserve MSBASIC forum, Pel*Ican coming soon).
  147.  
  148. A tip of the pelican's beak to OsoSoft George Campbell who suggested the
  149. original idea for this DLL.  It has been extensively tested by me and
  150. George, but YMMV.
  151.  
  152. You are free to try this DLL for 30 days.
  153.  
  154. If you decide to use it thereafter, you are obligated to send $10 to
  155.                      PAUL POELLINGER
  156.                      2019 Round Lake Drive
  157.                      Houston, TX  77077
  158. After doing so, you are free to use it in your applications, and
  159. to distribute it with such applications, as long as you do not
  160. charge separately for the DLL or publish its calling conventions.
  161.  
  162. You are free to pass this package on to others or upload it to
  163. bulletin boards provided that 1) you do not charge for it above
  164. the cost of distribution, and 2) all parts of the package are
  165. included (see "included" at the top).
  166.  
  167. Thank you for supporting shareware.
  168. -------------------------------------------------------------------
  169. Let me know if you have any trouble or suggestions.
  170.  
  171.       Paul Poellinger
  172.       Compuserve 70732,3576
  173.                                       4-24-93
  174.